Skip to content

Instantly share code, notes, and snippets.

@webketje
webketje / README.md
Last active May 10, 2024 18:09
Soundcloud Downloader Clean - Tampermonkey userscript OR bookmarklet

Tampermonkey userscript - Soundcloud Downloader Clean

An ad-less, multilingual, clean Soundcloud downloader with robust code. Adds a 'Download' button to all single track views.

Features

  • No third-party embeds, redirects or ads, directly uses the Soundcloud API.
@0xmjk
0xmjk / pyspark-df-lowercase.py
Created December 14, 2017 19:01
Make all column names in a DataFrame lowercase (PySpark)
# chain DataFrame.withColumnRenamed() calls for each df.schema.fields
df = reduce(lambda chain, column: chain.withColumnRenamed(*column),
map(lambda field: (field.name, str.lower(field.name)),
df.schema.fields),
df)
@ericmjl
ericmjl / ds-project-organization.md
Last active May 10, 2024 18:06
How to organize your Python data science project

UPDATE: I have baked the ideas in this file inside a Python CLI tool called pyds-cli. Please find it here: https://github.com/ericmjl/pyds-cli

How to organize your Python data science project

Having done a number of data projects over the years, and having seen a number of them up on GitHub, I've come to see that there's a wide range in terms of how "readable" a project is. I'd like to share some practices that I have come to adopt in my projects, which I hope will bring some organization to your projects.

Disclaimer: I'm hoping nobody takes this to be "the definitive guide" to organizing a data project; rather, I hope you, the reader, find useful tips that you can adapt to your own projects.

Disclaimer 2: What I’m writing below is primarily geared towards Python language users. Some ideas may be transferable to other languages; others may not be so. Please feel free to remix whatever you see here!

@wojteklu
wojteklu / clean_code.md
Last active May 10, 2024 18:05
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@dlovell
dlovell / dbg-nix-pkg.sh
Last active May 10, 2024 18:05
A helper function to `nix develop` on a package
# https://nixos.wiki/wiki/Nixpkgs/Create_and_debug_packages#Using_nix-shell_for_package_development
function debug_nix_package () {
set -u
packageName=${1:-default}
flakeDir=${2:-$(pwd)}
tmpdir=${3:-$(mktemp --directory --suffix=-nix-dbg)}
system=${4:-$(uname --machine)-$(uname --kernel-name | tr '[:upper:]' '[:lower:]')}
cd "$tmpdir" || exit
ln -s "$flakeDir" flakeDir
@Klerith
Klerith / pasos-node-ts-jest.md
Created August 19, 2023 18:35
Note + TypeScript + Jest = Testing

Pasos para configurar Jest con TypeScript, en Node

Documentación oficial sobre Jest

  1. Instalaciones de desarrollo (super test es útil para probar Express)
npm install -D jest @types/jest ts-jest supertest
@conorbranagan
conorbranagan / gist:4513828
Last active May 10, 2024 18:03
Linux System Metrics

Linux System Metrics

CPU

  • system.cpu.idle: % Idle CPU
  • system.cpu.system: % System CPU
  • system.cpu.user: % User CPU

Disk

@broestls
broestls / Remove_VMwareTools.ps1
Last active May 10, 2024 18:01
Force removal of VMware Tools, Program Files, and Windows Services
# This script will manually rip out all VMware Tools registry entries and files for Windows 2008-2019
# Tested for 2019, 2016, and probably works on 2012 R2 after the 2016 fixes.
# This function pulls out the common ID used for most of the VMware registry entries along with the ID
# associated with the MSI for VMware Tools.
function Get-VMwareToolsInstallerID {
foreach ($item in $(Get-ChildItem Registry::HKEY_CLASSES_ROOT\Installer\Products)) {
If ($item.GetValue('ProductName') -eq 'VMware Tools') {
return @{
reg_id = $item.PSChildName;
@geooot
geooot / graded_splash_bg.png
Last active May 10, 2024 18:00
Graded. The easiest and prettiest way to check your HAC grades. http://geooot.com/graded/
graded_splash_bg.png
JOINING DATA IN POSTGRESQL
Target is to join two or more database together in a single table
Innerjoin in SQL
Select p1.country, p1.continent,
Prime_minister, president
FROM prime_ministers AS p1
INNER JOIN presidents AS p2
ON p1.country = p2.country;
=====================================================================
Inner join